<template>

<el-form :model="presentlist" :rules="rules" ref="presentlist" label-width="100px" class="demo-presentlist">
    <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="归属点">
          <el-select placeholder="请输入归属点" v-model="presentlist.acptsiteid" ><!--需要添加v-model绑定数据 v-model="formInline.acptsiteid"-->
            <el-option label="全部" value="全部"></el-option>
            <el-option label="联通" value="联通"></el-option><!--value-->
            <el-option label="移动" value="移动"></el-option>
            <el-option label="电信" value="电信"></el-option>
          </el-select>
        </el-form-item>
    </el-form>
  <el-form-item label="礼品编码" prop="acptsiteid">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
   <el-form-item label="库存数量" prop="stocknum">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
   <el-form-item label="入库数量" prop="totalnum">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
   <el-form-item label="最后入库数量" prop="last_in">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
   <el-form-item label="领取数量" prop="obtainnum">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
  <el-form-item label="地区编码" prop="areaid">
    <el-input v-model="presentlist.name"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="submitForm('presentlist')">立即创建</el-button>
    <el-button @click="resetForm('presentlist')">重置</el-button>
  </el-form-item>
</el-form>    
</template>
<script>
  export default {
    data() {
      return {
        presentlist: {
            giftcode: '',//礼品编码
            acptsiteid: '',//归属点
            stocknum : '',//库存数量
            totalnum : '',//入库数量
            last_in :'',//最后入库数量
            obtainnum: '',//领取数量
            areaid:''//地区编码
        },
        rules: {
         giftcode: [
            { required: true, message: '请输入礼品编码', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          acptsiteid: [
            { required: true, message: '请输入归属点', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          stocknum: [
            { required: true, message: '请输入库存数量', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          totalnum: [
            { required: true, message: '请输入入库数量', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          last_in: [
            { required: true, message: '请输入最后入库数量', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          obtainnum: [
            { required: true, message: '请输入领取数量', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
          areaid: [
            { required: true, message: '请输入地区编码', trigger: 'blur' },
            { min: 4, max: 4, message: '长度4位数编码', trigger: 'blur' }
          ],
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>
